fix: add exports to package.json for Node.JS v20.19.0
#940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Node.JS export conditions to
package.json, so that the examples of things likeimport '@cypress/code-coverage/support'continue to work in Node.JS v20.19.0.I've added
package.jsontoo since it's theoretically possible somebody didrequire("@cypress/code-coverage/package.json"), so we should support that too.See: https://nodejs.org/api/packages.html#exports
The bug this fixes
I'm not sure why, but
import "@cypress/code-coverage/task"in acypress.config.tsfile seems to break in Node.JS v20.19.0, despite working before, with:I think this is probably a bug in
ts-node/esm, since it looks like there's a similar issue with@swc-node/register/esm-register: nodejs/node#57536Still, it's worth changing this package so that
import '@cypress/code-coverage/support'works in ESM too!